import request from '@/utils/request'

// 查询考试报名列表
export function listExamRegistration(query) {
  return request({
    url: '/examation/examRegistration/list',
    method: 'get',
    params: query
  })
}

// 查询考试报名所有列表
export function listAllExamRegistration(query) {
  return request({
    url: '/examation/examRegistration/listAll',
    method: 'get',
    params: query
  })
}

// 查询考试报名详细
export function getExamRegistration(id) {
  return request({
    url: '/examation/examRegistration/getInfo/' + id,
    method: 'get'
  })
}

// 新增考试报名
export function addExamRegistration(data) {
  return request({
    url: '/examation/examRegistration/add',
    method: 'post',
    data: data
  })
}

// 修改考试报名
export function updateExamRegistration(data) {
  return request({
    url: '/examation/examRegistration/edit',
    method: 'post',
    data: data
  })
}

// 删除考试报名
export function delExamRegistration(id) {
  return request({
    url: '/examation/examRegistration/remove/' + id,
    method: 'get'
  })
}

// 当前用户报名考试
export function registerExam(data) {
  return request({
    url: '/examation/examRegistration/register',
    method: 'post',
    data: data
  })
}

// 替其他用户报名考试
export function registerForUser(data) {
  return request({
    url: '/examation/examRegistration/registerForUser',
    method: 'post',
    data: data
  })
}

// 查询报名人员列表
export function getRegistrationUsers(examId, venueId) {
  return request({
    url: '/examation/examRegistration/registrationUsers',
    method: 'get',
    params: {
      examId: examId,
      venueId: venueId
    }
  })
}

// 根据考试ID和考试时间ID查询报名人员列表
export function getRegistrationUsersBySchedule(examId, scheduleId, query) {
  return request({
    url: '/examation/examRegistration/registrationUsersBySchedule',
    method: 'get',
    params: {
      examId: examId,
      scheduleId: scheduleId,
      ...query
    }
  })
}

// 当前用户报名考试（基于考试时间）
export function registerBySchedule(data) {
  return request({
    url: '/examation/examRegistration/registerBySchedule',
    method: 'post',
    data: data
  })
}